package com.itxx.allTools.KeyCase.test1;

import java.util.Arrays;

//冒泡排序
public class Test {
    public static void main(String[] args) {
        int[] arr = {1, 332, 43, 25, 3324, 34, 335, 4, 45, 2, 43, 52, 54};
        getBubbleSort(arr);
    }

    private static void getBubbleSort(int[] arr) {
        boolean b = true;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr.length-1; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                    b=false;
                }
                System.out.println("第"+(j+1)+"趟排序"+ Arrays.toString(arr));
            }
            break;
        }
    }
}
